package com.czxy.test;

import com.czxy.config.SpringConfig;
import com.czxy.dao.DogDao;
import com.czxy.domain.Cat;
import com.czxy.domain.Dog;
import com.czxy.domain.User;
import com.czxy.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.annotation.Resource;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {SpringConfig.class})

public class Demo01 {

    @Autowired
    private Dog dog;
    @Autowired
    private Dog dog1;
    @Autowired
    private Dog dog2;
    @Autowired
    private Dog dog3;

    @Test
    public  void  test03(){
        System.out.println("dog1="+dog1);
        System.out.println("dog2="+dog2);
        System.out.println("dog3="+dog3);
    }

    @Test
    public  void t01(){

        dog.eat();

    }






    @Resource(name = "aDogDao")
    private DogDao dogDao;

    @Test
    public  void   test02(){
        dogDao.lookHome();
    }


    @Resource
    private Cat cat;

    @Test
    public  void  t02(){
        cat.eat();
    }



    @Resource
    private User  user;

    @Test
    public  void  t03(){
        user.eat();
    }

    @Resource
    private UserService userService;

    @Test
    public  void t04(){
        userService.add();
        userService.del();
        userService.update();
    }









}
